package com.tiancheng.trade.payment.util;

import java.util.Calendar;

/**
 * @Auther: ld
 * @Date: 2024/3/3 18:58
 * @Param ${tags}
 * @Description:
 */
public class TsTimeUtil {
    /**
     * unix时间戳（格林威治时间），精确到秒
     *
     * @return
     */
    public static String getUTCTimeStr() {
        Calendar cal = Calendar.getInstance();
        int zoneOffset = cal.get(Calendar.ZONE_OFFSET);
        int dstOffset = cal.get(Calendar.DST_OFFSET);
        cal.add(Calendar.MILLISECOND, -(zoneOffset + dstOffset));
        return String.valueOf(cal.getTimeInMillis() / 1000);
    }

}
